import React from 'react'
import {
    useNavigate,
    useLocation,
    useParams
} from "react-router-dom"

function withRouter(Com) {
  return (props) => {
        const navigate = useNavigate()
        const location = useLocation()
        const params = useParams()
        return <Com {...props} router={{navigate,location,params}}></Com>
  }
}

export default withRouter